<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>
BidiFormatter (Soy Complete)
</TITLE>


<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="BidiFormatter (Soy Complete)";
    }
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">
<HR>


<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiGlobalDir.html" title="class in com.google.template.soy.internal.i18n"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../../../index.html?com/google/template/soy/internal/i18n/BidiFormatter.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="BidiFormatter.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
com.google.template.soy.internal.i18n</FONT>
<BR>
Class BidiFormatter</H2>
<PRE>
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
  <IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by "><B>com.google.template.soy.internal.i18n.BidiFormatter</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>BidiFormatter</B><DT>extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></DL>
</PRE>

<P>
Utility class for formatting text for display in a potentially opposite-directionality context
 without garbling. The directionality of the context is set at formatter creation and the
 directionality of the text can be either estimated or passed in when known. Provides the
 following functionality:
 <p>
 1. BiDi Wrapping
 When text in one language is mixed into a document in another, opposite-directionality language,
 e.g. when an English business name is embedded in a Hebrew web page, both the inserted string
 and the text following it may be displayed incorrectly unless the inserted string is explicitly
 separated from the surrounding text in a "wrapper" that declares its directionality at the start
 and then resets it back at the end. This wrapping can be done in HTML mark-up (e.g. a
 'span dir=\"rtl\"' tag) or - only in contexts where mark-up cannot be used - in Unicode BiDi
 formatting codes (LRE|RLE and PDF). Optionally, the mark-upp can be inserted even when the
 directionality the same, in order to keep the DOM structure more stable. Providing such wrapping
 services is the basic purpose of the BiDi formatter.
 <p>
 2. Directionality estimation
 How does one know whether a string about to be inserted into surrounding text has the same
 directionality? Well, in many cases, one knows that this must be the case when writing the code
 doing the insertion, e.g. when a localized message is inserted into a localized page. In such
 cases there is no need to involve the BiDi formatter at all. In some other cases, it need not be
 the same as the context, but is either constant (e.g. urls are always LTR) or otherwise known.
 In the remaining cases, e.g. when the string is user-entered or comes from a database, the
 language of the string (and thus its directionality) is not known a priori, and must be
 estimated at run-time. The BiDi formatter can do this automatically.
 <p>
 3. Escaping
 When wrapping plain text - i.e. text that is not already HTML or HTML-escaped - in HTML mark-up,
 the text must first be HTML-escaped to prevent XSS attacks and other nasty business. This of
 course is always true, but the escaping can not be done after the string has already been wrapped
 in mark-up, so the BiDi formatter also serves as a last chance and includes escaping services.
 <p>
 Thus, in a single call, the formatter will escape the input string as specified, determine its
 directionality, and wrap it as necessary. It is then up to the caller to insert the return value
 in the output.
<P>

<P>
<HR>

<P>

<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#dirAttr(java.lang.String)">dirAttr</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Operates like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#dirAttr(java.lang.String, boolean)"><CODE>dirAttr(String, boolean)</CODE></A>, but assumes <code>isHtml</code> is false.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#dirAttr(java.lang.String, boolean)">dirAttr</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
        boolean&nbsp;isHtml)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns "dir=\"ltr\"" or "dir=\"rtl\"", depending on <code>str</code>'s estimated directionality,
 if it is not the same as the context directionality.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#dirAttrValue(java.lang.String)">dirAttrValue</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Operates like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#dirAttrValue(java.lang.String, boolean)"><CODE>dirAttrValue(String, boolean)</CODE></A>, but assumes <code>isHtml</code> is false.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#dirAttrValue(java.lang.String, boolean)">dirAttrValue</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
             boolean&nbsp;isHtml)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns "rtl" if <code>str</code>'s estimated directionality is RTL, and "ltr" if it is LTR.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#endEdge()">endEdge</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns "left" for RTL context directionality.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#estimateDirection(java.lang.String)">estimateDirection</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#estimateDirection(java.lang.String, boolean)"><CODE>estimateDirection(String, boolean)</CODE></A>, but assumes <code>isHtml</code> is false.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#estimateDirection(java.lang.String, boolean)">estimateDirection</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
                  boolean&nbsp;isHtml)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Estimates the directionality of a string using the best known general-purpose method, i.e.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#getAlwaysSpan()">getAlwaysSpan</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#getContextDir()">getContextDir</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html" title="class in com.google.template.soy.internal.i18n">BidiFormatter</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#getInstance(com.google.template.soy.internal.i18n.BidiUtils.Dir)">getInstance</A></B>(<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A>&nbsp;contextDir)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Factory for creating an instance of BidiFormatter given the context directionality.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html" title="class in com.google.template.soy.internal.i18n">BidiFormatter</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#getInstance(com.google.template.soy.internal.i18n.BidiUtils.Dir, boolean)">getInstance</A></B>(<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A>&nbsp;contextDir,
            boolean&nbsp;alwaysSpan)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Factory for creating an instance of BidiFormatter given the context directionality and the
 desired span wrapping behavior (see below).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html" title="class in com.google.template.soy.internal.i18n">BidiFormatter</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#getInstance(boolean)">getInstance</A></B>(boolean&nbsp;rtlContext)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Factory for creating an instance of BidiFormatter given the context directionality.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html" title="class in com.google.template.soy.internal.i18n">BidiFormatter</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#getInstance(boolean, boolean)">getInstance</A></B>(boolean&nbsp;rtlContext,
            boolean&nbsp;alwaysSpan)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Factory for creating an instance of BidiFormatter given the context directionality and the
 desired span wrapping behavior (see below).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html" title="class in com.google.template.soy.internal.i18n">BidiFormatter</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#getInstance(java.util.Locale)">getInstance</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util">Locale</A>&nbsp;locale)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Factory for creating an instance of BidiFormatter given the context locale.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html" title="class in com.google.template.soy.internal.i18n">BidiFormatter</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#getInstance(java.util.Locale, boolean)">getInstance</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util">Locale</A>&nbsp;locale,
            boolean&nbsp;alwaysSpan)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Factory for creating an instance of BidiFormatter given the context locale and the desired
 span wrapping behavior (see below).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#isRtlContext()">isRtlContext</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#knownDirAttr(com.google.template.soy.internal.i18n.BidiUtils.Dir)">knownDirAttr</A></B>(<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A>&nbsp;dir)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns "dir=\"ltr\"" or "dir=\"rtl\"", depending on the given directionality, if it is not
 the same as the context directionality.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#knownDirAttrValue(com.google.template.soy.internal.i18n.BidiUtils.Dir)">knownDirAttrValue</A></B>(<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A>&nbsp;dir)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns "rtl" if the given directionality is RTL, and "ltr" if it is LTR.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#mark()">mark</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the Unicode BiDi mark matching the context directionality (LRM for LTR context
 directionality, RLM for RTL context directionality), or the empty string for neutral / unknown
 context directionality.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#markAfter(java.lang.String)">markAfter</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Operates like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#markAfter(java.lang.String, boolean)"><CODE>markAfter(String, boolean)</CODE></A>, but assumes
 <code>isHtml</code> is false.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#markAfter(java.lang.String, boolean)">markAfter</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
          boolean&nbsp;isHtml)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a Unicode BiDi mark matching the context directionality
 (LRM or RLM) if either the directionality or the exit directionality of
 <code>str</code> is opposite to the context directionality.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#spanWrap(java.lang.String)">spanWrap</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Operates like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#spanWrap(java.lang.String, boolean, boolean)"><CODE>spanWrap(String, boolean, boolean)</CODE></A>, but assumes <code>isHtml</code> is false
 and <code>dirReset</code> is true.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#spanWrap(java.lang.String, boolean)">spanWrap</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
         boolean&nbsp;isHtml)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Operates like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#spanWrap(java.lang.String, boolean, boolean)"><CODE>spanWrap(String, boolean, boolean)</CODE></A>, but assumes <code>dirReset</code> is
 true.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#spanWrap(java.lang.String, boolean, boolean)">spanWrap</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
         boolean&nbsp;isHtml,
         boolean&nbsp;dirReset)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Formats a string of unknown directionality for use in HTML output of the context
 directionality, so an opposite-directionality string is neither garbled nor garbles what
 follows it.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#spanWrapWithKnownDir(com.google.template.soy.internal.i18n.BidiUtils.Dir, java.lang.String)">spanWrapWithKnownDir</A></B>(<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A>&nbsp;dir,
                     <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Operates like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#spanWrapWithKnownDir(com.google.template.soy.internal.i18n.BidiUtils.Dir, java.lang.String, boolean, boolean)"><CODE>spanWrapWithKnownDir(BidiUtils.Dir, String, boolean, boolean)</CODE></A>, but
 assumes <code>isHtml</code> is false and <code>dirReset</code> is true.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#spanWrapWithKnownDir(com.google.template.soy.internal.i18n.BidiUtils.Dir, java.lang.String, boolean)">spanWrapWithKnownDir</A></B>(<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A>&nbsp;dir,
                     <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
                     boolean&nbsp;isHtml)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Operates like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#spanWrapWithKnownDir(com.google.template.soy.internal.i18n.BidiUtils.Dir, java.lang.String, boolean, boolean)"><CODE>spanWrapWithKnownDir(BidiUtils.Dir, String, boolean, boolean)</CODE></A>, but
 assumes <code>dirReset</code> is true.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#spanWrapWithKnownDir(com.google.template.soy.internal.i18n.BidiUtils.Dir, java.lang.String, boolean, boolean)">spanWrapWithKnownDir</A></B>(<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A>&nbsp;dir,
                     <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
                     boolean&nbsp;isHtml,
                     boolean&nbsp;dirReset)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Formats a string of given directionality for use in HTML output of the context directionality,
 so an opposite-directionality string is neither garbled nor garbles what follows it.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#startEdge()">startEdge</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns "right" for RTL context directionality.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#unicodeWrap(java.lang.String)">unicodeWrap</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Operates like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#unicodeWrap(java.lang.String, boolean, boolean)"><CODE>unicodeWrap(String, boolean, boolean)</CODE></A>, but assumes <code>isHtml</code> is
 false and <code>dirReset</code> is true.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#unicodeWrap(java.lang.String, boolean)">unicodeWrap</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
            boolean&nbsp;isHtml)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Operates like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#unicodeWrap(java.lang.String, boolean, boolean)"><CODE>unicodeWrap(String, boolean, boolean)</CODE></A>, but assumes <code>dirReset</code> is
 true.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#unicodeWrap(java.lang.String, boolean, boolean)">unicodeWrap</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
            boolean&nbsp;isHtml,
            boolean&nbsp;dirReset)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Formats a string of unknown directionality for use in plain-text output of the context
 directionality, so an opposite-directionality string is neither garbled nor garbles what
 follows it.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#unicodeWrapWithKnownDir(com.google.template.soy.internal.i18n.BidiUtils.Dir, java.lang.String)">unicodeWrapWithKnownDir</A></B>(<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A>&nbsp;dir,
                        <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Operates like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#unicodeWrapWithKnownDir(com.google.template.soy.internal.i18n.BidiUtils.Dir, java.lang.String, boolean, boolean)"><CODE>unicodeWrapWithKnownDir(BidiUtils.Dir, String, boolean, boolean)</CODE></A>, but
 assumes <code>isHtml</code> is false and <code>dirReset</code> is true.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#unicodeWrapWithKnownDir(com.google.template.soy.internal.i18n.BidiUtils.Dir, java.lang.String, boolean)">unicodeWrapWithKnownDir</A></B>(<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A>&nbsp;dir,
                        <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
                        boolean&nbsp;isHtml)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Operates like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#unicodeWrapWithKnownDir(com.google.template.soy.internal.i18n.BidiUtils.Dir, java.lang.String, boolean, boolean)"><CODE>unicodeWrapWithKnownDir(BidiUtils.Dir, String, boolean, boolean)</CODE></A>, but
 assumes <code>dirReset</code> is true.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#unicodeWrapWithKnownDir(com.google.template.soy.internal.i18n.BidiUtils.Dir, java.lang.String, boolean, boolean)">unicodeWrapWithKnownDir</A></B>(<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A>&nbsp;dir,
                        <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
                        boolean&nbsp;isHtml,
                        boolean&nbsp;dirReset)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Formats a string of given directionality for use in plain-text output of the context
 directionality, so an opposite-directionality string is neither garbled nor garbles what
 follows it.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="getInstance(com.google.template.soy.internal.i18n.BidiUtils.Dir, boolean)"><!-- --></A><H3>
getInstance</H3>
<PRE>
public static <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html" title="class in com.google.template.soy.internal.i18n">BidiFormatter</A> <B>getInstance</B>(<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A>&nbsp;contextDir,
                                        boolean&nbsp;alwaysSpan)</PRE>
<DL>
<DD>Factory for creating an instance of BidiFormatter given the context directionality and the
 desired span wrapping behavior (see below).
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>contextDir</CODE> - The context directionality. Try not to use Dir.UNKNOWN, since it is
 impossible to reset the directionality back to the context when it is unknown.<DD><CODE>alwaysSpan</CODE> - Whether <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#spanWrap(java.lang.String, boolean, boolean)"><CODE>spanWrap(java.lang.String, boolean, boolean)</CODE></A> (and its variations) should always use a 'span'
     tag, even when the input directionality is neutral or matches the context, so that the DOM
     structure of the output does not depend on the combination of directionalities</DL>
</DD>
</DL>
<HR>

<A NAME="getInstance(com.google.template.soy.internal.i18n.BidiUtils.Dir)"><!-- --></A><H3>
getInstance</H3>
<PRE>
public static <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html" title="class in com.google.template.soy.internal.i18n">BidiFormatter</A> <B>getInstance</B>(<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A>&nbsp;contextDir)</PRE>
<DL>
<DD>Factory for creating an instance of BidiFormatter given the context directionality. The
 default behavior of <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#spanWrap(java.lang.String, boolean, boolean)"><CODE>spanWrap(java.lang.String, boolean, boolean)</CODE></A> and its variations is set to avoid span wrapping unless
 there's a reason ('dir' attribute should be appended).
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>contextDir</CODE> - The context directionality. Try not to use Dir.UNKNOWN, since it is
 impossible to reset the directionality back to the context when it is unknown.</DL>
</DD>
</DL>
<HR>

<A NAME="getInstance(boolean, boolean)"><!-- --></A><H3>
getInstance</H3>
<PRE>
public static <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html" title="class in com.google.template.soy.internal.i18n">BidiFormatter</A> <B>getInstance</B>(boolean&nbsp;rtlContext,
                                        boolean&nbsp;alwaysSpan)</PRE>
<DL>
<DD>Factory for creating an instance of BidiFormatter given the context directionality and the
 desired span wrapping behavior (see below).
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>rtlContext</CODE> - Whether the context directionality is RTL<DD><CODE>alwaysSpan</CODE> - Whether <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#spanWrap(java.lang.String, boolean, boolean)"><CODE>spanWrap(java.lang.String, boolean, boolean)</CODE></A> (and its variations) should always use a 'span'
     tag, even when the input directionality is neutral or matches the context, so that the DOM
     structure of the output does not depend on the combination of directionalities</DL>
</DD>
</DL>
<HR>

<A NAME="getInstance(boolean)"><!-- --></A><H3>
getInstance</H3>
<PRE>
public static <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html" title="class in com.google.template.soy.internal.i18n">BidiFormatter</A> <B>getInstance</B>(boolean&nbsp;rtlContext)</PRE>
<DL>
<DD>Factory for creating an instance of BidiFormatter given the context directionality. The
 default behavior of <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#spanWrap(java.lang.String, boolean, boolean)"><CODE>spanWrap(java.lang.String, boolean, boolean)</CODE></A> and its variations is set to avoid span wrapping unless
 there's a reason ('dir' attribute should be appended).
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>rtlContext</CODE> - Whether the context directionality is RTL</DL>
</DD>
</DL>
<HR>

<A NAME="getInstance(java.util.Locale, boolean)"><!-- --></A><H3>
getInstance</H3>
<PRE>
public static <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html" title="class in com.google.template.soy.internal.i18n">BidiFormatter</A> <B>getInstance</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util">Locale</A>&nbsp;locale,
                                        boolean&nbsp;alwaysSpan)</PRE>
<DL>
<DD>Factory for creating an instance of BidiFormatter given the context locale and the desired
 span wrapping behavior (see below).
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>locale</CODE> - The context locale<DD><CODE>alwaysSpan</CODE> - Whether <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#spanWrap(java.lang.String, boolean, boolean)"><CODE>spanWrap(java.lang.String, boolean, boolean)</CODE></A> (and its variations) should always use a 'span'
     tag, even when the input directionality is neutral or matches the context, so that the DOM
     structure of the output does not depend on the combination of directionalities</DL>
</DD>
</DL>
<HR>

<A NAME="getInstance(java.util.Locale)"><!-- --></A><H3>
getInstance</H3>
<PRE>
public static <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html" title="class in com.google.template.soy.internal.i18n">BidiFormatter</A> <B>getInstance</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util">Locale</A>&nbsp;locale)</PRE>
<DL>
<DD>Factory for creating an instance of BidiFormatter given the context locale. The default
 behavior of <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#spanWrap(java.lang.String, boolean, boolean)"><CODE>spanWrap(java.lang.String, boolean, boolean)</CODE></A> and its variations is set to avoid span wrapping unless there's a
 reason ('dir' attribute should be appended).
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>locale</CODE> - The context locale</DL>
</DD>
</DL>
<HR>

<A NAME="getContextDir()"><!-- --></A><H3>
getContextDir</H3>
<PRE>
public <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A> <B>getContextDir</B>()</PRE>
<DL>
<DD><DL>

<DT><B>Returns:</B><DD>The context directionality</DL>
</DD>
</DL>
<HR>

<A NAME="isRtlContext()"><!-- --></A><H3>
isRtlContext</H3>
<PRE>
public boolean <B>isRtlContext</B>()</PRE>
<DL>
<DD><DL>

<DT><B>Returns:</B><DD>Whether the context directionality is RTL</DL>
</DD>
</DL>
<HR>

<A NAME="getAlwaysSpan()"><!-- --></A><H3>
getAlwaysSpan</H3>
<PRE>
public boolean <B>getAlwaysSpan</B>()</PRE>
<DL>
<DD><DL>

<DT><B>Returns:</B><DD>Whether the span structure added by the formatter should be stable, i.e. spans added
 even when the directionality does not need to be declared</DL>
</DD>
</DL>
<HR>

<A NAME="dirAttrValue(java.lang.String, boolean)"><!-- --></A><H3>
dirAttrValue</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>dirAttrValue</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
                           boolean&nbsp;isHtml)</PRE>
<DL>
<DD>Returns "rtl" if <code>str</code>'s estimated directionality is RTL, and "ltr" if it is LTR. In case
 it's UNKNOWN, returns "rtl" if the context directionality is RTL, and "ltr" otherwise.
 Needed for GXP, which can't handle dirAttr.<p>
 Example use case: <td expr:dir='bidiFormatter.dirAttrValue(foo)'><gxp:eval expr='foo'></td>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>str</CODE> - String whose directionality is to be estimated<DD><CODE>isHtml</CODE> - Whether <code>str</code> is HTML / HTML-escaped
<DT><B>Returns:</B><DD>"rtl" if <code>str</code>'s estimated directionality is RTL, and "ltr" otherwise.</DL>
</DD>
</DL>
<HR>

<A NAME="dirAttrValue(java.lang.String)"><!-- --></A><H3>
dirAttrValue</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>dirAttrValue</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str)</PRE>
<DL>
<DD>Operates like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#dirAttrValue(java.lang.String, boolean)"><CODE>dirAttrValue(String, boolean)</CODE></A>, but assumes <code>isHtml</code> is false.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>str</CODE> - String whose directionality is to be estimated
<DT><B>Returns:</B><DD>"rtl" if <code>str</code>'s estimated directionality is RTL, and "ltr" otherwise.</DL>
</DD>
</DL>
<HR>

<A NAME="knownDirAttrValue(com.google.template.soy.internal.i18n.BidiUtils.Dir)"><!-- --></A><H3>
knownDirAttrValue</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>knownDirAttrValue</B>(<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A>&nbsp;dir)</PRE>
<DL>
<DD>Returns "rtl" if the given directionality is RTL, and "ltr" if it is LTR. In case the given
 directionality is UNKNOWN, returns "rtl" if the context directionality is RTL, and "ltr"
 otherwise.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>dir</CODE> - Given directionality
<DT><B>Returns:</B><DD>"rtl" if the given directionality is RTL, and "ltr" otherwise.</DL>
</DD>
</DL>
<HR>

<A NAME="dirAttr(java.lang.String, boolean)"><!-- --></A><H3>
dirAttr</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>dirAttr</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
                      boolean&nbsp;isHtml)</PRE>
<DL>
<DD>Returns "dir=\"ltr\"" or "dir=\"rtl\"", depending on <code>str</code>'s estimated directionality,
 if it is not the same as the context directionality.
 Otherwise, returns the empty string.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>str</CODE> - String whose directionality is to be estimated<DD><CODE>isHtml</CODE> - Whether <code>str</code> is HTML / HTML-escaped
<DT><B>Returns:</B><DD>"dir=\"rtl\"" for RTL text in non-RTL context; "dir=\"ltr\"" for LTR text in non-LTR
     context; else, the empty string.</DL>
</DD>
</DL>
<HR>

<A NAME="dirAttr(java.lang.String)"><!-- --></A><H3>
dirAttr</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>dirAttr</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str)</PRE>
<DL>
<DD>Operates like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#dirAttr(java.lang.String, boolean)"><CODE>dirAttr(String, boolean)</CODE></A>, but assumes <code>isHtml</code> is false.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>str</CODE> - String whose directionality is to be estimated
<DT><B>Returns:</B><DD>"dir=\"rtl\"" for RTL text in non-RTL context; "dir=\"ltr\"" for LTR text in non-LTR
     context; else, the empty string.</DL>
</DD>
</DL>
<HR>

<A NAME="knownDirAttr(com.google.template.soy.internal.i18n.BidiUtils.Dir)"><!-- --></A><H3>
knownDirAttr</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>knownDirAttr</B>(<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A>&nbsp;dir)</PRE>
<DL>
<DD>Returns "dir=\"ltr\"" or "dir=\"rtl\"", depending on the given directionality, if it is not
 the same as the context directionality.
 Otherwise, returns the empty string.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>dir</CODE> - Given directionality
<DT><B>Returns:</B><DD>"dir=\"rtl\"" for RTL text in non-RTL context; "dir=\"ltr\"" for LTR text in non-LTR
     context; else, the empty string.</DL>
</DD>
</DL>
<HR>

<A NAME="spanWrap(java.lang.String, boolean, boolean)"><!-- --></A><H3>
spanWrap</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>spanWrap</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
                       boolean&nbsp;isHtml,
                       boolean&nbsp;dirReset)</PRE>
<DL>
<DD>Formats a string of unknown directionality for use in HTML output of the context
 directionality, so an opposite-directionality string is neither garbled nor garbles what
 follows it.<p>
 The algorithm: estimates the directionality of input argument <code>str</code>. In case its
 directionality doesn't match the context directionality, wraps it with a 'span' tag and adds a
 "dir" attribute (either 'dir=\"rtl\"' or 'dir=\"ltr\"').<p>
 If <code>setAlwaysSpan(true)</code> was used, the input is always wrapped with 'span', skipping just
 the dir attribute when it's not needed.
 <p>
 If <code>dirReset</code>, and if the overall directionality or the exit directionality of
 <code>str</code> are opposite to the context directionality, a trailing unicode BiDi mark matching
 the context directionality is appended (LRM or RLM).
 <p>
 If !<code>isHtml</code>, HTML-escapes <code>str</code> regardless of wrapping.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>str</CODE> - The input string<DD><CODE>isHtml</CODE> - Whether <code>str</code> is HTML / HTML-escaped<DD><CODE>dirReset</CODE> - Whether to append a trailing unicode bidi mark matching the context
     directionality, when needed, to prevent the possible garbling of whatever may follow
     <code>str</code>
<DT><B>Returns:</B><DD>Input string after applying the above processing.</DL>
</DD>
</DL>
<HR>

<A NAME="spanWrap(java.lang.String, boolean)"><!-- --></A><H3>
spanWrap</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>spanWrap</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
                       boolean&nbsp;isHtml)</PRE>
<DL>
<DD>Operates like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#spanWrap(java.lang.String, boolean, boolean)"><CODE>spanWrap(String, boolean, boolean)</CODE></A>, but assumes <code>dirReset</code> is
 true.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>str</CODE> - The input string<DD><CODE>isHtml</CODE> - Whether <code>str</code> is HTML / HTML-escaped
<DT><B>Returns:</B><DD>Input string after applying the above processing.</DL>
</DD>
</DL>
<HR>

<A NAME="spanWrap(java.lang.String)"><!-- --></A><H3>
spanWrap</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>spanWrap</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str)</PRE>
<DL>
<DD>Operates like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#spanWrap(java.lang.String, boolean, boolean)"><CODE>spanWrap(String, boolean, boolean)</CODE></A>, but assumes <code>isHtml</code> is false
 and <code>dirReset</code> is true.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>str</CODE> - The input string
<DT><B>Returns:</B><DD>Input string after applying the above processing.</DL>
</DD>
</DL>
<HR>

<A NAME="spanWrapWithKnownDir(com.google.template.soy.internal.i18n.BidiUtils.Dir, java.lang.String, boolean, boolean)"><!-- --></A><H3>
spanWrapWithKnownDir</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>spanWrapWithKnownDir</B>(<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A>&nbsp;dir,
                                   <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
                                   boolean&nbsp;isHtml,
                                   boolean&nbsp;dirReset)</PRE>
<DL>
<DD>Formats a string of given directionality for use in HTML output of the context directionality,
 so an opposite-directionality string is neither garbled nor garbles what follows it.<p>
 The algorithm: estimates the directionality of input argument <code>str</code>. In case its
 directionality doesn't match the context directionality, wraps it with a 'span' tag and adds a
 "dir" attribute (either 'dir=\"rtl\"' or 'dir=\"ltr\"').<p>
 If <code>setAlwaysSpan(true)</code> was used, the input is always wrapped with 'span', skipping just
 the dir attribute when it's not needed.
 <p>
 If <code>dirReset</code>, and if the overall directionality or the exit directionality of
 <code>str</code> are opposite to the context directionality, a trailing unicode BiDi mark matching
 the context directionality is appended (LRM or RLM).
 <p>
 If !<code>isHtml</code>, HTML-escapes <code>str</code> regardless of wrapping.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>dir</CODE> - <code>str</code>'s directionality<DD><CODE>str</CODE> - The input string<DD><CODE>isHtml</CODE> - Whether <code>str</code> is HTML / HTML-escaped<DD><CODE>dirReset</CODE> - Whether to append a trailing unicode bidi mark matching the context
     directionality, when needed, to prevent the possible garbling of whatever may follow
     <code>str</code>
<DT><B>Returns:</B><DD>Input string after applying the above processing.</DL>
</DD>
</DL>
<HR>

<A NAME="spanWrapWithKnownDir(com.google.template.soy.internal.i18n.BidiUtils.Dir, java.lang.String, boolean)"><!-- --></A><H3>
spanWrapWithKnownDir</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>spanWrapWithKnownDir</B>(<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A>&nbsp;dir,
                                   <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
                                   boolean&nbsp;isHtml)</PRE>
<DL>
<DD>Operates like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#spanWrapWithKnownDir(com.google.template.soy.internal.i18n.BidiUtils.Dir, java.lang.String, boolean, boolean)"><CODE>spanWrapWithKnownDir(BidiUtils.Dir, String, boolean, boolean)</CODE></A>, but
 assumes <code>dirReset</code> is true.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>dir</CODE> - <code>str</code>'s directionality<DD><CODE>str</CODE> - The input string<DD><CODE>isHtml</CODE> - Whether <code>str</code> is HTML / HTML-escaped
<DT><B>Returns:</B><DD>Input string after applying the above processing.</DL>
</DD>
</DL>
<HR>

<A NAME="spanWrapWithKnownDir(com.google.template.soy.internal.i18n.BidiUtils.Dir, java.lang.String)"><!-- --></A><H3>
spanWrapWithKnownDir</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>spanWrapWithKnownDir</B>(<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A>&nbsp;dir,
                                   <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str)</PRE>
<DL>
<DD>Operates like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#spanWrapWithKnownDir(com.google.template.soy.internal.i18n.BidiUtils.Dir, java.lang.String, boolean, boolean)"><CODE>spanWrapWithKnownDir(BidiUtils.Dir, String, boolean, boolean)</CODE></A>, but
 assumes <code>isHtml</code> is false and <code>dirReset</code> is true.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>dir</CODE> - <code>str</code>'s directionality<DD><CODE>str</CODE> - The input string
<DT><B>Returns:</B><DD>Input string after applying the above processing.</DL>
</DD>
</DL>
<HR>

<A NAME="unicodeWrap(java.lang.String, boolean, boolean)"><!-- --></A><H3>
unicodeWrap</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>unicodeWrap</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
                          boolean&nbsp;isHtml,
                          boolean&nbsp;dirReset)</PRE>
<DL>
<DD>Formats a string of unknown directionality for use in plain-text output of the context
 directionality, so an opposite-directionality string is neither garbled nor garbles what
 follows it. As opposed to <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#spanWrap(java.lang.String, boolean, boolean)"><CODE>spanWrap(java.lang.String, boolean, boolean)</CODE></A>, this makes use of unicode BiDi formatting
 characters. In HTML, its *only* valid use is inside of elements that do not allow mark-up, e.g.
 an 'option' tag.<p>
 The algorithm: estimates the directionality of input argument <code>str</code>. In case it doesn't
 match  the context directionality, wraps it with Unicode BiDi formatting characters:
 RLE+<code>str</code>+PDF for RTL text, or LRE+<code>str</code>+PDF for LTR text.
 <p>
 If <code>opt_dirReset</code>, and if the overall directionality or the exit directionality of
 <code>str</code> are opposite to the context directionality, a trailing unicode BiDi mark matching
 the context directionality is appended (LRM or RLM).
 <p>
 Does *not* do HTML-escaping regardless of the value of <code>isHtml</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>str</CODE> - The input string<DD><CODE>isHtml</CODE> - Whether <code>str</code> is HTML / HTML-escaped<DD><CODE>dirReset</CODE> - Whether to append a trailing unicode bidi mark matching the context
     directionality, when needed, to prevent the possible garbling of whatever may follow
     <code>str</code>
<DT><B>Returns:</B><DD>Input string after applying the above processing.</DL>
</DD>
</DL>
<HR>

<A NAME="unicodeWrap(java.lang.String, boolean)"><!-- --></A><H3>
unicodeWrap</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>unicodeWrap</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
                          boolean&nbsp;isHtml)</PRE>
<DL>
<DD>Operates like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#unicodeWrap(java.lang.String, boolean, boolean)"><CODE>unicodeWrap(String, boolean, boolean)</CODE></A>, but assumes <code>dirReset</code> is
 true.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>str</CODE> - The input string<DD><CODE>isHtml</CODE> - Whether <code>str</code> is HTML / HTML-escaped
<DT><B>Returns:</B><DD>Input string after applying the above processing.</DL>
</DD>
</DL>
<HR>

<A NAME="unicodeWrap(java.lang.String)"><!-- --></A><H3>
unicodeWrap</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>unicodeWrap</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str)</PRE>
<DL>
<DD>Operates like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#unicodeWrap(java.lang.String, boolean, boolean)"><CODE>unicodeWrap(String, boolean, boolean)</CODE></A>, but assumes <code>isHtml</code> is
 false and <code>dirReset</code> is true.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>str</CODE> - The input string
<DT><B>Returns:</B><DD>Input string after applying the above processing.</DL>
</DD>
</DL>
<HR>

<A NAME="unicodeWrapWithKnownDir(com.google.template.soy.internal.i18n.BidiUtils.Dir, java.lang.String, boolean, boolean)"><!-- --></A><H3>
unicodeWrapWithKnownDir</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>unicodeWrapWithKnownDir</B>(<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A>&nbsp;dir,
                                      <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
                                      boolean&nbsp;isHtml,
                                      boolean&nbsp;dirReset)</PRE>
<DL>
<DD>Formats a string of given directionality for use in plain-text output of the context
 directionality, so an opposite-directionality string is neither garbled nor garbles what
 follows it. As opposed to <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#spanWrapWithKnownDir(com.google.template.soy.internal.i18n.BidiUtils.Dir, java.lang.String, boolean, boolean)"><CODE>spanWrapWithKnownDir(com.google.template.soy.internal.i18n.BidiUtils.Dir, java.lang.String, boolean, boolean)</CODE></A>, this makes use of unicode BiDi
 formatting characters. In HTML, its *only* valid use is inside of elements that do not allow
 mark-up, e.g. an 'option' tag.<p>
 The algorithm: estimates the directionality of input argument <code>str</code>. In case it doesn't
 match  the context directionality, wraps it with Unicode BiDi formatting characters:
 RLE+<code>str</code>+PDF for RTL text, or LRE+<code>str</code>+PDF for LTR text.
 <p>
 If <code>opt_dirReset</code>, and if the overall directionality or the exit directionality of
 <code>str</code> are opposite to the context directionality, a trailing unicode BiDi mark matching
 the context directionality is appended (LRM or RLM).
 <p>
 Does *not* do HTML-escaping regardless of the value of <code>isHtml</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>dir</CODE> - <code>str</code>'s directionality<DD><CODE>str</CODE> - The input string<DD><CODE>isHtml</CODE> - Whether <code>str</code> is HTML / HTML-escaped<DD><CODE>dirReset</CODE> - Whether to append a trailing unicode bidi mark matching the context
     directionality, when needed, to prevent the possible garbling of whatever may follow
     <code>str</code>
<DT><B>Returns:</B><DD>Input string after applying the above processing.</DL>
</DD>
</DL>
<HR>

<A NAME="unicodeWrapWithKnownDir(com.google.template.soy.internal.i18n.BidiUtils.Dir, java.lang.String, boolean)"><!-- --></A><H3>
unicodeWrapWithKnownDir</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>unicodeWrapWithKnownDir</B>(<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A>&nbsp;dir,
                                      <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
                                      boolean&nbsp;isHtml)</PRE>
<DL>
<DD>Operates like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#unicodeWrapWithKnownDir(com.google.template.soy.internal.i18n.BidiUtils.Dir, java.lang.String, boolean, boolean)"><CODE>unicodeWrapWithKnownDir(BidiUtils.Dir, String, boolean, boolean)</CODE></A>, but
 assumes <code>dirReset</code> is true.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>dir</CODE> - <code>str</code>'s directionality<DD><CODE>str</CODE> - The input string<DD><CODE>isHtml</CODE> - Whether <code>str</code> is HTML / HTML-escaped
<DT><B>Returns:</B><DD>Input string after applying the above processing.</DL>
</DD>
</DL>
<HR>

<A NAME="unicodeWrapWithKnownDir(com.google.template.soy.internal.i18n.BidiUtils.Dir, java.lang.String)"><!-- --></A><H3>
unicodeWrapWithKnownDir</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>unicodeWrapWithKnownDir</B>(<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A>&nbsp;dir,
                                      <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str)</PRE>
<DL>
<DD>Operates like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#unicodeWrapWithKnownDir(com.google.template.soy.internal.i18n.BidiUtils.Dir, java.lang.String, boolean, boolean)"><CODE>unicodeWrapWithKnownDir(BidiUtils.Dir, String, boolean, boolean)</CODE></A>, but
 assumes <code>isHtml</code> is false and <code>dirReset</code> is true.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>dir</CODE> - <code>str</code>'s directionality<DD><CODE>str</CODE> - The input string
<DT><B>Returns:</B><DD>Input string after applying the above processing.</DL>
</DD>
</DL>
<HR>

<A NAME="markAfter(java.lang.String, boolean)"><!-- --></A><H3>
markAfter</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>markAfter</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
                        boolean&nbsp;isHtml)</PRE>
<DL>
<DD>Returns a Unicode BiDi mark matching the context directionality
 (LRM or RLM) if either the directionality or the exit directionality of
 <code>str</code> is opposite to the context directionality. Otherwise returns
 the empty string.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>str</CODE> - String after which the mark may need to appear<DD><CODE>isHtml</CODE> - Whether <code>str</code> is HTML / HTML-escaped
<DT><B>Returns:</B><DD>LRM for RTL text in LTR context; RLM for LTR text in RTL context;
     else, the empty string.</DL>
</DD>
</DL>
<HR>

<A NAME="markAfter(java.lang.String)"><!-- --></A><H3>
markAfter</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>markAfter</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str)</PRE>
<DL>
<DD>Operates like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#markAfter(java.lang.String, boolean)"><CODE>markAfter(String, boolean)</CODE></A>, but assumes
 <code>isHtml</code> is false.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>str</CODE> - String after which the mark may need to appear
<DT><B>Returns:</B><DD>LRM for RTL text in LTR context; RLM for LTR text in RTL context;
     else, the empty string.</DL>
</DD>
</DL>
<HR>

<A NAME="mark()"><!-- --></A><H3>
mark</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>mark</B>()</PRE>
<DL>
<DD>Returns the Unicode BiDi mark matching the context directionality (LRM for LTR context
 directionality, RLM for RTL context directionality), or the empty string for neutral / unknown
 context directionality.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="startEdge()"><!-- --></A><H3>
startEdge</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>startEdge</B>()</PRE>
<DL>
<DD>Returns "right" for RTL context directionality. Otherwise (LTR or neutral / unknown context
 directionality) returns "left".
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="endEdge()"><!-- --></A><H3>
endEdge</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>endEdge</B>()</PRE>
<DL>
<DD>Returns "left" for RTL context directionality. Otherwise (LTR or neutral / unknown context
 directionality) returns "right".
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="estimateDirection(java.lang.String, boolean)"><!-- --></A><H3>
estimateDirection</H3>
<PRE>
public static <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A> <B>estimateDirection</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str,
                                              boolean&nbsp;isHtml)</PRE>
<DL>
<DD>Estimates the directionality of a string using the best known general-purpose method, i.e.
 using relative word counts. Dir.UNKNOWN return value indicates completely neutral input.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>str</CODE> - String whose directionality is to be estimated<DD><CODE>isHtml</CODE> - Whether <code>str</code> is HTML / HTML-escaped
<DT><B>Returns:</B><DD><code>str</code>'s estimated overall directionality</DL>
</DD>
</DL>
<HR>

<A NAME="estimateDirection(java.lang.String)"><!-- --></A><H3>
estimateDirection</H3>
<PRE>
public static <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiUtils.Dir.html" title="enum in com.google.template.soy.internal.i18n">BidiUtils.Dir</A> <B>estimateDirection</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;str)</PRE>
<DL>
<DD>Like <A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiFormatter.html#estimateDirection(java.lang.String, boolean)"><CODE>estimateDirection(String, boolean)</CODE></A>, but assumes <code>isHtml</code> is false.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>str</CODE> - String whose directionality is to be estimated
<DT><B>Returns:</B><DD><code>str</code>'s estimated overall directionality</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>


<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;<A HREF="../../../../../../com/google/template/soy/internal/i18n/BidiGlobalDir.html" title="class in com.google.template.soy.internal.i18n"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../../../index.html?com/google/template/soy/internal/i18n/BidiFormatter.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="BidiFormatter.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>

        
          <div id="footer">
            <div id="footerlogo" style="float:left">
              <img src="http://www.google.com/images/art.gif"
                   alt="Google colored balls">
            </div>
            <div id="copyright" style="float:left">
              <p>
                &copy; 2009 Google -
                <a href="http://www.google.com/privacy.html">Privacy Policy</a> -
                <a href="http://www.google.com/terms_of_service.html">Terms and Conditions</a> -
                <a href="http://www.google.com/about.html">About Google</a>
              </p>
            </div>
          </div>
        
      
</BODY>
</HTML>
